 
<%@page import="doantotnghiep.modelDTO.ProviderDTO"%>
<%@page import="doantotnghiep.model.Provider"%>
<%@page import="doantotnghiep.modelDTO.CategoryDTO"%>
<%@page import="doantotnghiep.modelDTO.MeasureUnitDTO"%>
<%@page import="java.util.HashMap"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="doantotnghiep.model.Customer"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@page import="java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/resources/css/table.css" />" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/resources/css/button.css" />" />

<title>Cập nhật thông tin dược phẩm</title>
</head>
<body>
<% HashMap<String, Object> medicamentModel = (HashMap<String, Object>) request.getAttribute("medicamentModel");
 %>	
<br>
<br>
<div align="center">
	<center>
		<h1 style="color: blue;">CẬP NHẬT THÔNG TIN DƯỢC PHẨM</h1>
		<br> <br>

		<!-- In dòng thông báo là thành công hay không -->
		<p style="color: green; font-size: 15px; font-weight: bold;">
		</p>

		<br>
		<div align="center">

       <form:form method="POST" commandName="MedicamentDTO" >
		<table>
			<form:hidden path="id" value="${medicamentModel.medicamentDTO.id}" />
			<tr>
				<td><form:label path="medicamentName">Tên sản phẩm:</form:label></td>
				<td><form:input path="medicamentName"value="${medicamentModel.medicamentDTO.medicamentName}"></form:input></td>
			</tr>
			<tr>
				<td><form:label path="measure_ID">Mã đơn vị tính:</form:label></td>
				 <td><form:select path="measure_ID" value="${medicamentModel.medicamentDTO.measure_ID}">
			           <%
			            if(medicamentModel!=null){
   					    	 ArrayList<MeasureUnitDTO> measureUnitDTOs =(ArrayList<MeasureUnitDTO>) medicamentModel.get("measure");
   					   		 if(measureUnitDTOs!=null){ 
   					         	for (int i = 0; i < measureUnitDTOs.size(); i++) {			 
						   	 %>
				            <option value="<%=measureUnitDTOs.get(i).getId()%>"><%=measureUnitDTOs.get(i).getUnitName()%></option>
				           <%}}}%>
						</form:select></td>
					</tr>
            <tr>
				<td><form:label path="category_ID">Mã nhóm sản phẩm:</form:label></td>
				 <td><form:select path="category_ID" value="${medicamentModel.medicamentDTO.category_ID}">
			           <%
			            if(medicamentModel!=null){
   					    	 ArrayList<CategoryDTO> categoryDTOs =(ArrayList<CategoryDTO>) medicamentModel.get("category");
   					   		 if(categoryDTOs!=null){ 
   					         	for (int i = 0; i < categoryDTOs.size(); i++) {			 
						   	 %>
				            <option value="<%=categoryDTOs.get(i).getId()%>"><%=categoryDTOs.get(i).getCategoryName()%></option>
				           <%}}}%>
						</form:select></td>
					</tr>
			<tr>
				<td><form:label path="provider_ID">Nhà cung cấp:</form:label></td>
				 <td><form:select path="provider_ID" value="${medicamentModel.medicamentDTO.provider_ID}">
			           <%
			            if(medicamentModel!=null){
			            	
   					    	 ArrayList<ProviderDTO> providertDTOs =(ArrayList<ProviderDTO>) medicamentModel.get("providers");
   					   		 if(providertDTOs!=null){ 
   					   		 System.out.print("anh");
   					         	for (int i = 0; i < providertDTOs.size(); i++) {			 
						   	 %>
				            <option value="<%=providertDTOs.get(i).getId()%>"><%=providertDTOs.get(i).getFullName()%></option>
				           <%}}}%>
						</form:select></td>
			</tr>
			 <tr>
			 <tr>
				<td><form:label path="boughtPrice">Đơn giá nhập:</form:label></td>
				<td><form:input path="boughtPrice" value="${medicamentModel.medicamentDTO.boughtPrice}"  /></td>	
			</tr>
			 <tr>
				<td><form:label path="sellPrice">Đơn giá bán:</form:label></td>
				<td><form:input path="sellPrice" value="${medicamentModel.medicamentDTO.sellPrice}" /></td>	
			</tr>
			<tr>
				<td ><input id="editmedicamentsubmit" type="button" value="Cập nhật" /></td>
				<td ><input id="editmedicamentcancel" type="button" value="Hủy" /></td>
			</tr>
		 </table>
	     </form:form>

		</div>


	</center>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>
